package main

import "fmt"
import "strconv"

func main() {
	//fmt.Sprintf
	var j = 20
	var t = 89.835643455
	var u = true
	var any = 'm'
	str1 := fmt.Sprintf("%d", j)
	fmt.Printf("值:%v---类型:%T\n", str1, str1)
	str2 := fmt.Sprintf("%.4f", t)
	str3 := fmt.Sprintf("%t", u)
	str4 := fmt.Sprintf("%c", any)
	fmt.Printf("值:%v---类型:%T\n", str2, str2)
	fmt.Printf("值:%v---类型:%T\n", str3, str3)
	fmt.Printf("值:%v---类型:%T\n", str4, str4)
	//strconv
	str5 := strconv.FormatInt(int64(j), 10)
	str6 := strconv.FormatFloat(float64(t), 'f', 4, 32)
	str7 := strconv.FormatBool(u) //可以用if-else
	str8 := strconv.FormatUint(uint64(any), 10)
	fmt.Printf("值:%v---类型:%T\n", str5, str5)
	fmt.Printf("值:%v---类型:%T\n", str6, str6)
	fmt.Printf("值:%v---类型:%T\n", str7, str7)
	fmt.Printf("值:%v---类型:%T\n", str8, str8)
	fmt.Printf("值:%v---类型:%T\n", str8, str8)

}
